﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Srvtools
{
    public partial class CommandTextAddTableDialog : Form
    {
        private List<String> _selectedTablesList = new List<string>();

        public CommandTextAddTableDialog(List<String> tablesList)
        {
            InitializeComponent();
            ListTables.DataSource = tablesList;
        }

        public List<String> SelectedTables
        { 
            get { return _selectedTablesList; } 
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (ListTables.SelectedItems == null)
            { }
            else
            {
                foreach (Object i in ListTables.SelectedItems)
                {
                    _selectedTablesList.Add(i.ToString());
                }
            }
            Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void ListTables_DoubleClick(object sender, EventArgs e)
        {
            btnOK_Click(btnOK, null);
        }
    }
}